package net.fpeg.kotlin.msa.wordbase.dao

import net.fpeg.kotlin.msa.wordbase.entity.Word
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.JpaSpecificationExecutor

interface WordDao : JpaRepository<Word, Long> {
    fun findByValueContaining(value: String): List<Word>
    fun getByValue(value: String): Word?
    fun findByValue(value: String): List<Word>
    fun findDistinctByWordBases_WordUser_Id(userId: Long, pageable: Pageable): Page<Word>
    fun findDistinctByWordBases_WordUser_Id(userId: Long): Set<Word>
    fun findDistinctByWordBases_WordUser_IdAndValueContaining(userId: Long, wordValue: String): Set<Word>
    fun findDistinctByWordBases_WordUser_IdAndWordBases_WordTag_Value(userId: Long, tagValue: String): Set<Word>
    fun findDistinctByWordBases_WordUser_IdAndValueContainingAndWordBases_WordTag_Value(userId: Long, wordValue: String, tagValue: String): Set<Word>

}